import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

// export default new Router({
//     routes: [
//         {
//             path: "/login",
//             name: "UserLogin",
//             component: () => import('@/views/UserLogin')
//         },
//         {
//             path: '/',
//             name: 'Index',
//             component: () => import('@/views/Index'),
//             redirect: "/shouye",
//             children: [
//                 {
//                     path: "/shouye",
//                     name: "Shouye",
//                     component: () => import('@/views/ShouYe')
//                 },
//                 {
//                     path: "/employee",
//                     name: "Employee",
//                     component: () => import('@/views/EmployeeManger')
//                 }
//             ]
//         }
//     ],
//     mode: 'history'  //去掉#
// })

const constantRoutes = [
            {
                path: "/login",
                name: "Login",
                component: () => import('@/views/Login')
            },
            {
                path: '/',
                name: 'Index',
                component: () => import('@/views/Index'),
                redirect: "/Shouye",
                children: [
                    {
                        path: "/Shouye",
                        name: "Shouye",
                        component: () => import('@/views/Shouye')
                    },
                    {
                        path: "/index",
                        component: () => import('@/views/user/admin/index')
                    },
                    

                   
                   
                    
                   
                   
                ]
            }
        ]
const createRouter = () => new Router({
    mode: 'history',
    routes: constantRoutes
})

const router = createRouter()


// 重置路由
export function resetRouter() {
    const newRouter = createRouter()
    router.matcher = newRouter.matcher
}

export default router
